package kevin.workplan.web.controller.base;

import java.util.HashMap;
import java.util.Map;

import kevin.workplan.util.Constant;
/**
 * @author huangjinjie
 *
 */
public class BaseJsonController extends BaseController{

	protected Map<String, Object> errorResult(String message, Object data) {
        return resultMap(Constant.JSON_ERROR,message,data);
    }
	protected Map<String, Object> successResult(Object data) {
        return resultMap(Constant.JSON_SUCCESS,"",data);
    }
    protected Map<String, Object> resultMap(int code, String message, Object data) {
        Map<String, Object> result = new HashMap<String, Object>();
        result.put("code", code);
        result.put("data", data);
        result.put("message", message);

        return result;
    }
}
